/****************************************************************
** Tutorial_Arduino_PWM                     
**
** Original Author:      Sammy_K
** Webpage:              www.dreamgineer.org
**
** Project:              Dreamgineer Tutorials: Arduino
** Written On:           May 2012
** Last Updated:         May 2012
**
** A Simple Example That Demonstrates How To Use The 
** analogWrite() Function To Generate A PWM Signal Used To Control
** The Brightness Of An LED
**
****************************************************************/


//Declare Variables
unsigned char pwmVal = 0;    //Variable To Store Duty Cycle Value

/****************************************************************
** setup() - Executes Once On Boot
**
** Set DIO PIN 11 As Output To Drive Discrete LED Using PWM
**
****************************************************************/
void setup()
{
  pinMode(11, OUTPUT); //Configure Pin 13 As Output To Drive LED
}

/****************************************************************
** loop() - Executes Repeatadly After setup() returns.
**
** Increase The PWM Duty Cycle By One Every 10 mS.  When Duty
** Cycle Reaches 100% (255) Roll Over To 0.
**
****************************************************************/
void loop()
{
  analogWrite(11, pwmVal);   //Update PWM Duty Cycle
  pwmVal++;                  //Increment pwmVal
  delay(10);                 //Delay 10 mS
}

/****************************************************************
** Copyright (c) Dreamgineer.org
**
** Permission to use, copy, modify, and distribute this software 
** for any purpose with or without fee is hereby granted, 
** provided that the above copyright notice and this permission 
** notice appear in all copies. 
**
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 
** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 
** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL 
** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 
** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
****************************************************************/

